declare global {
  interface Window {
    BlobBuilder?: VoidFunction
    WebKitBlobBuilder?: VoidFunction
    MozBlobBuilder?: VoidFunction
    MSBlobBuilder?: VoidFunction
  }
}
export default () => (t: BlobPart, e: string, r: any, o: any) => {
  const a: any = self || window
  try {
    try {
      var n: any
      try {
        n = new a.Blob([t])
      } catch (e) {
        n = new (a.BlobBuilder || a.WebKitBlobBuilder || a.MozBlobBuilder || a.MSBlobBuilder)()
        n.append(t)
        n = n.getBlob()
      }
      var Url = a.URL || a.webkitURL,
        p = Url.createObjectURL(n),
        i = new a[e](p, r)
      Url.revokeObjectURL(p)
      return i
    } catch (o) {
      return new a[e]("data:application/javascript,".concat(encodeURIComponent(t as string)), r)
    }
  } catch (t) {
    if (!o) throw Error("Inline worker is not supported")
    return new a[e](o, r)
  }
}
